Microsoft Silverlight 5 and Windows Azure Enterprise Integration by 2012

Microsoft Silverlight 5 and Windows Azure Enterprise Integration by 2012

Author:2012
Language: eng
Format: mobi
Publisher: Packt Publishing
Published: 2015-05-25T09:28:36.498363+00:00


Right-click on the WCFServiceWebRole project, select Add new item and add a Global Application Class named Global.asax.

Modify the Application_Start method inside Global.asax, so that it will construct the tables if they do not exist. This should only be called once in the application, as there is a performance penalty if you attempt to create a table that already exists. The following gets the account details from the configuration file. Once it has the account details, it creates all the required tables by looking at the table names used inside the NewsArticleDataServiceContext class. The NewsArticleDataServiceContext class inserts and retrieves all the entities within it from a single table named NewsArticles, so that a single table will be created:using System;

using Microsoft.WindowsAzure;

using Microsoft.WindowsAzure.ServiceRuntime;

using Microsoft.WindowsAzure.StorageClient;

namespace WCFServiceWebRole

{

public class Global : System.Web.HttpApplication

{

protected void Application_Start(object sender, EventArgs e)

{

var account = CloudStorageAccount.Parse (RoleEnvironment.GetConfigurationSettingValue ("AzureStorageConnectionString"));

// create the tables by looking inside NewsArticleDataServiceContext and discovering the names of tables

CloudTableClient.CreateTablesFromModel( typeof(NewsArticleDataServiceContext), account.TableEndpoint.AbsoluteUri, account.Credentials);

}

}

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.